package com.yylending.las.lending.process.result;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.content.Loader;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import com.yyfax.infrastructure.mvp.Presenter;
import com.yylending.las.R;
import com.yylending.las.base.BaseFragment;
import com.yylending.las.common.utils.FormatUtils;
import com.yylending.las.StatIDSet;
import com.yyfax.infrastructure.statistics.StatService;
import com.yylending.las.lending.process.ProcessActivity;

/**
 * Created by ying_he on 2017/6/16.<br>
 * Copyright  2017 www.yylending.com. All Rights Reserved.<br><br>
 */

public class SiteInvestigationFragment extends BaseFragment {

    @BindView(R.id.loan_sum_tv)
    TextView mLoanSumTv;
    @BindView(R.id.confirm_btn)
    Button mConfirmBtn;
    Unbinder mUnbind;

    public static BaseFragment newInstance() {
        BaseFragment fragment = new SiteInvestigationFragment();
        return fragment;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_loan_success_no_site_investigation, null);
        mUnbind = ButterKnife.bind(this, view);
        return view;
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
		String strLoanSum = String.format(getString(R.string.to_loan_money), FormatUtils.getDecoratedAmountWithSymbol(ProcessActivity.mProcess.businessSum));
        mLoanSumTv.setText(strLoanSum);
    }

    @OnClick({R.id.confirm_btn})
    public void confirmBtnClicked(View v){
		//StatService.onEvent(getContext(), StatIDSet.EVENT_ID_COMPLETE_BORROW_MONEY_SUBMIT);
		getActivity().finish();
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
    }

    @Override
    public void onLoadFinished(Loader<Presenter> loader, Presenter data, int placeholder) {

    }

    @Override
    public Loader<Presenter> onCreateLoader(int id, Bundle args) {
        return null;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        mUnbind.unbind();
    }
}
